package com.bana.fvs.app.mvp.model;

import com.bana.fvs.app.mvp.ConstantsValue;
import com.bana.fvs.app.mvp.contract.DetailContract;
import com.bana.fvs.app.util.CommonUtils;
import com.wei.commonlibrary.net.OkhttpRequest;

import java.util.HashMap;

/**
 * Author : yanftch
 * Date : 2018/3/2
 * Time : 22:29
 * Desc :
 */

public class DetailModel extends DetailContract.AbsDetailModel {
    @Override
    public void onStart() {

    }

    @Override
    public OkhttpRequest http_fogAreaEquipment(String token, String wqbm) {
        HashMap<String, Object> map = new HashMap<>();
        map.put(ConstantsValue.TOKEN, token);
        map.put(ConstantsValue.WQBM, wqbm);
        return okhttpRequest.url(iApiService.getFogInfo(map));
    }

    @Override
    public OkhttpRequest http_foglightEquipment(String token, String sbbm, String kzpbm) {
        HashMap<String, Object> params = CommonUtils.getParams(token);
        params.put("wdbm", sbbm);
        params.put("kzqbm", kzpbm);
        return okhttpRequest.url(iApiService.getFoglightInfo(params));
    }

    /**
     * 区域控制器
     *
     * @param sbbm 设备编码
     * @return
     */
    @Override
    public OkhttpRequest http_controllerEquipment(String token, String sbbm) {
        HashMap<String, Object> params = CommonUtils.getParams(token);
        params.put(ConstantsValue.SBBM, sbbm);
        return okhttpRequest.url(iApiService.getAreaCtrlInfo(params));
    }

    /**
     * 能见度检测仪
     *
     * @param sbbm 设备编码
     * @return
     */
    @Override
    public OkhttpRequest http_visibilityDetectionquipment(String token, String sbbm) {
        HashMap<String, Object> params = CommonUtils.getParams(token);
        params.put(ConstantsValue.SBBM, sbbm);
        return okhttpRequest.url(iApiService.getVisibDetectInfo(params));
    }

    @Override
    public OkhttpRequest http_updateFogAreaTimer(String token, String wqbh, boolean sfds) {

        HashMap<String, Object> params = CommonUtils.getParams(token);

        HashMap<String,Object> data=new HashMap<>();

        data.put("wqbm",wqbh);

        if(sfds)
            data.put("sfds",1);
        else
            data.put("sfds",0);

        params.put("data",data);

        return okhttpRequest.url(iApiService.updateFogAreaTimer(params));
    }

    @Override
    public OkhttpRequest http_foglightWorkModeUpdate(String token, HashMap<String, Object> data) {
        HashMap<String, Object> params = CommonUtils.getParams(token);

        params.put("data",data);

        return okhttpRequest.url(iApiService.getFoglightUpdate(params));
    }
}
